fix(exports): correct ./components/* source targets for two non-tsx modules - #446
Open
YevheniiKotyrlo wants to merge 1 commit into
Open
Conversation
… modules `./components/*` declares `source` and `react-native` as `./src/components/*.tsx`, but `copyComponentProperties` is authored `.ts` and `index` is `.cts`/`.ts`. Export conditions match on key presence rather than target existence, so both subpaths are a hard ERR_MODULE_NOT_FOUND under either condition, with no fallthrough to import/require. `react-native` is live: Expo sets it for iOS and Android. `source` is what react-native-builder-bob's example-app workflow runs on. An exact key beats a pattern regardless of declaration order, so two entries resolve it. `index` takes `.cts` to match what the existing exact `./components` entry already declares. Closes nativewind#445
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the four broken targets reported in #445.
The defect
./components/*declaressourceandreact-nativeas./src/components/*.tsx, but two modules the pattern matches are not authored.tsx:Export conditions match on key presence, not target existence, so there is no fallthrough to
import/require— both subpaths are a hardERR_MODULE_NOT_FOUNDunder either condition:react-nativeis not dormant — Expo sets it for iOS and Android viaunstable_conditionsByPlatform.sourceis the conditionreact-native-builder-bob's example-app workflow runs on.The fix
Two exact keys. An exact key beats a pattern regardless of declaration order, mirroring the existing
./components/react-native-gesture-handlerentry.indextakes.ctsrather than.tsbecause that is what the exact./componentsentry already declares — the wildcard's.tsxguess contradicted the map's own neighbouring entry.Verification
Applied against the published 3.0.7 tarball, both subpaths resolve under
sourceandreact-native, and every other entry is unchanged. I checked the whole map rather than just these two: 509 declared targets across every entry and every condition, 0 missing after the fix.That sweep is how the defect surfaced. It walks the real
dist/module/**tree, expands each wildcard over it (skipping stems that have an exact key, since exact beats pattern) and asserts every declared target exists. It is generic — nothing in it is specific to my project — and it needsdist/**, so it belongs as a post-preparecheck rather than an ordinary jest test. Happy to add it to this PR if you would like it; I left it out to keep this reviewable as a one-file fix.